<template>
    <div class="video-list">
        <el-table :data="tableData?.items" stripe border>
            <el-table-column prop="id" label="ID" show-overflow-tooltip width="180"></el-table-column>
            <el-table-column prop="title" label="标题" show-overflow-tooltip width="350"></el-table-column>
            <el-table-column prop="typeName" label="类型" width="60"></el-table-column>
            <el-table-column label="状态" width="100">
                <template #default="scope">
                    <el-tag v-if="scope.row.status==1" type="primary">待审核</el-tag>
                    <el-tag v-if="scope.row.status==2" type="warning">自动审核中</el-tag>
                    <el-tag v-if="scope.row.status==3" type="warning">人工审核中</el-tag>
                    <el-tag v-if="scope.row.status==4" type="danger">被驳回</el-tag>
                    <el-tag v-if="scope.row.status==5" type="success">审核成功</el-tag>
                </template>
            </el-table-column>
            <el-table-column prop="failReason" label="上次驳回原因" show-overflow-tooltip width="280"></el-table-column>
            <el-table-column prop="failOrPassTime" label="最后审核时间" show-overflow-tooltip width="140"></el-table-column>
            <el-table-column label="创建时间" show-overflow-tooltip>
                <template #default="scope">
                    {{scope.row.createTime}}
                </template>
            </el-table-column>
        </el-table>
    </div>


    <div class="pagination">
        <el-pagination layout="prev, pager, next" v-model:current-page="getNotListVideoParm.pageNo" :page-count="Number.parseInt(tableData?.page ?? '0')" @update:current-page="getNotListVideoInfo()" />
    </div>
</template>


<script setup lang="ts">
    import {ref,onMounted} from 'vue'
    import NotListVideoInfo from '../../types/author/NotListVideoInfo'
    import Page from '../../base/page'
    import request from '../../base/request'
    import GetNotListVideoParm from '../../types/author/GetNotListVideoParm'
    import { ElMessage } from 'element-plus'
    import formatTime from '@/utils/formatTime'
    const tableData = ref<Page<NotListVideoInfo>>()
    const getNotListVideoParm = ref<GetNotListVideoParm>({
        pageNo:1,
        pageSize:10
    })

    const getNotListVideoInfo = async () => {
        const response= (await request.post("/video/review/getNotListVideoInfo",getNotListVideoParm.value)).data
        if(response.code==200){
            tableData.value=response.data
        }else{
            ElMessage.error(response.msg)
        }
    }

    onMounted(() => {   
        getNotListVideoInfo()
    })
</script>


<style scoped>
    .video-list{
        margin-top: 10px;
    }

    .pagination{
        text-align: center;
        margin-left: 70vh;
    }

    :deep .el-table__row {
        height: 50px;
    }

</style>